package cn.hiapi.shopkeeper.jpa.order;

import cn.hiapi.basic.jpa.BasicRepository;
import cn.hiapi.shopkeeper.entity.order.ActivityBargainRecord;
import com.alibaba.fastjson.JSONObject;
import org.springframework.data.jpa.repository.Query;

/**
 * @author AdinZ
 * @date 2023/1/10 11:33
 */
public interface ActivityBargainRecordJpa extends BasicRepository<ActivityBargainRecord, Long> {

    /**
     * 统计砍价总额
     *
     * @param oid
     * @return
     */
    @Query("select count(e.id) as count,sum(e.price) as totalPrice from ActivityBargainRecord e where e.oid=?1")
    JSONObject totalOrder(long oid);
}
